package sjtu;

import java.util.Scanner;

public class Sjtu1021 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int n,temp,index,loop;
		int[][] arr;
		while(scan.hasNext()){
			n = scan.nextInt();
			arr = new int[n][n];
			index = 1;
			loop = 0;
			//i = 4,2;
			
			for(int j = n;j > 0;j -= 2){
				for(int i = 0;i < j - 1;i ++ ){
					arr[loop][i+loop] = index++;
				}
				
				for(int i = 0;i < j - 1;i ++ ){
					arr[i+loop][j - 1+loop] = index ++;
				}
				
				for(int i = j - 1;i > 0;i --){
					arr[j - 1+loop][i+loop] = index ++;
				}
				
				for (int i = j - 1; i > 0; i --) {
					arr[i+loop][loop] = index ++;
				}
				loop ++;
			}
			
			if(n % 2 == 1){
				arr[n / 2][n / 2] = n * n;
			}
			
			for(int[] ar : arr){
				for(int a : ar){
					System.out.printf("%6d",a);
				}
				System.out.println();
			}
		}
	}
	
	public static void main(String[] args) {
		new Sjtu1021().go();
	}
}
